//
//  LzwFestiValTableCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/2.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwFestiValTableCell.h"
#import "LzwBaseLable.h"
#import "LzwBaseImageView.h"
#import "UIImageView+WebCache.h"

@interface LzwFestiValTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myFestivalImage;
@property (nonatomic, retain) LzwBaseImageView *myFestivalImage1;

@property (nonatomic, retain) LzwBaseLable *myFestivalLable;
@property (nonatomic , retain) LzwBaseLable *myFestivalLable1;

@end

@implementation LzwFestiValTableCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatFestival];
    }
    return self;
}

- (void)creatFestival{
    
    //图片
    self.myFestivalImage = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myFestivalImage.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myFestivalImage];
    
    //喜爱图片
    self.myFestivalImage1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myFestivalImage1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myFestivalImage1];
    
    //描述
    self.myFestivalLable = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myFestivalLable.textColor = [UIColor lightGrayColor];
    self.myFestivalLable.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myFestivalLable.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myFestivalLable];
    
    //喜爱人数
    self.myFestivalLable1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myFestivalLable1.textColor = [UIColor lightGrayColor];
    self.myFestivalLable1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myFestivalLable1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myFestivalLable1];
    
    [_myFestivalImage release];
    [_myFestivalImage1 release];
    [_myFestivalLable release];
    [_myFestivalLable1 release];
    

    
}

-(void)setModleFestival:(LzwFestivalModle *)modleFestival{
    
    if (_modleFestival != modleFestival) {
        [_modleFestival release];
        _modleFestival = [modleFestival retain];
    }
    
    self.myFestivalLable.text = self.modleFestival.title;
    self.myFestivalLable1.text = self.modleFestival.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleFestival.pic];
    
    [self.myFestivalImage sd_setImageWithURL:url placeholderImage:nil];
    
    
}

@end
